home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Applications 1996 May
/
SGI IRIX 6.2 Applications 1996 May.iso
/
dist
/
impr_dev.idb
/
usr
/
impressario
/
src
/
libimp
/
impI.h.z
/
impI.h
Wrap
C/C++ Source or Header
|
1996-05-06
|
4KB
|
119 lines
/**************************************************************************
*
* Copyright (c) 1993 Silicon Graphics, Inc.
* All Rights Reserved
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by Silicon
* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is
* the property of Silicon Graphics, Inc. Any use, duplication or
* disclosure not specifically authorized by Silicon Graphics is strictly
* prohibited.
*
* RESTRICTED RIGHTS LEGEND:
*
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
* Technical Data and Computer Software clause at DFARS 52.227-7013,
* and/or in similar or successor clauses in the FAR, DOD or NASA FAR
* Supplement. Unpublished - rights reserved under the Copyright Laws of
* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.
* Shoreline Blvd., Mountain View, CA 94039-7311
**************************************************************************
*
* File: impI.h
*
* Description: Internal definitions and information for libimp. This
* header file is not intended to be included in any user level
* application program.
*
**************************************************************************/
#ident "$Revision: 1.3 $"
#ifndef __IMP_IMPI_H__
#define __IMP_IMPI_H__
#include <sys/types.h>
#include "msgs/uxsgiimpr.h"
#include "imp.h"
/* File structure info */
#define _IMP_TABLES_START 512L
/* Byte swaping macros */
#define _impSwapShort(swd) ((ushort_t)((((ushort_t)swd) >> 8) | \
(((ushort_t)swd) << 8)))
#define _impSwapLong(lwd) ((__uint32_t)((((__uint32_t)lwd) >> 24) | \
((((__uint32_t)lwd) >> 8) & 0xff00) | \
((((__uint32_t)lwd) << 8) & 0xff0000) | \
(((__uint32_t)lwd) << 24)))
/* Byte allocation macros */
#define _impBufferSize(xsize) (((xsize) + ((xsize) >> 6)) << 2)
#define _impBufferAlloc(image) \
((short*)malloc(_impBufferSize(impXSize(image))))
/* Memory allocation macros */
#define _impMalloc(ptr,type,num,macro) \
if ((ptr = (type*)malloc((num)*sizeof(type))) == NULL) \
macro(IMP_ERR_MEMALLOC)
/* Error macros */
#define _impReturnError(err_code) { \
IMPerrno = (err_code); \
return -1; \
}
#define _impReturnErrorPtr(err_code) { \
IMPerrno = (err_code); \
return NULL; \
}
/* Misc. macros */
#define _impBadRow(img,row,chan) (((row) >= impYSize(img)) || \
((chan) >= impNumChannels(img)))
#define _impWriting(image) ((image)->flags & _IOWRT)
#define _impReading(image) ((image)->flags & _IOREAD)
#define _impMin2(a,b) (((a) < (b))? (a): (b))
#define _impMax2(a,b) (((a) < (b))? (b): (a))
#define _impMin3(a,b,c) _impMin2(_impMin2((a),(b)),(c))
#define _impMax3(a,b,c) _impMax2(_impMax2((a),(b)),(c))
/* Internal function declarations */
#ifdef __cplusplus
extern "C" {
#endif
extern void _impSwapHeader(IMPImage *image);
extern void _impSwapShorts(ushort_t *arr, int nBytes);
extern void _impSwapLongs(__uint32_t *arr, int nBytes);
extern off_t _impSeekOffset(IMPImage *image, off_t offset);
extern off_t _impSeekRow(IMPImage *image, ushort_t row, ushort_t channel);
extern int _impWrite(IMPImage *image, void *buffer, uint_t count);
extern int _impRead(IMPImage *image, void *buffer, uint_t count);
#ifdef __cplusplus
}
#endif
#endif /* !__IMP_IMPI_H__ */